<template>
<div>
<el-breadcrumb separator='-'>
<el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item>商品管理</el-breadcrumb-item>
<el-breadcrumb-item>订单列表</el-breadcrumb-item>
</el-breadcrumb>

<el-card>
<el-row>
<el-col :span="8">
<el-input>
<el-button slot="append" icon="el-icon-search"></el-button>
</el-input>
</el-col>
</el-row>

<el-table :data="tableData">
<el-table-column type="index" label="#"></el-table-column>
<el-table-column label="订单编号" prop="order_number"></el-table-column>
<el-table-column label="订单价格（元）" prop="order_price"></el-table-column>
<el-table-column label="是否付款"><template slot-scope="scope"><el-tag type="primary" v-if="scope.row.pay_status!==0">已付款</el-tag><el-tag type="danger" v-else>未付款</el-tag></template></el-table-column>
<el-table-column label="是否发货" prop="is_send"></el-table-column>
<el-table-column label="下单时间" prop="create_time"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-edit" size="mini" @click="updateAdd"></el-button>
<el-button type="success" icon="el-icon-coordinate" size="mini" @click="showWuLiu"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pagenum"
      :page-sizes="[2, 5, 10]"
      :page-size="queryInfo.pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
</el-pagination>
</el-card>
<el-dialog
    title="修改地址"
    :visible.sync="dialogVisible"
    width="50%">
    <span>
    <el-form label-width="90px">
    <el-form-item label="省市区/县" required>
    <el-input v-model="queryInfo.roleName"></el-input>
    </el-form-item>
    <el-form-item label="详细地址" required>
    <el-input v-model="queryInfo.roleDesc"></el-input>
    </el-form-item>
    </el-form>
    </span>
    <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" >确 定</el-button>
    </span>
</el-dialog>
 <el-dialog 
    title="物流信息"
    :visible.sync="dialogVisibleo" 
    width="50%">
    <span>
    111
    </span>
    <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisibleo = false">取消</el-button>
    <el-button type="primary" >确定</el-button>
    </span>
</el-dialog>
</div>
</template>

<script>
export default{
    data(){
        return{
            tableData:'',
            queryInfo:{
                query:'',
                pagenum:1,
                pagesize:2
            },
            total:'',
            pagenum:'',
            dialogVisible:false,
            dialogVisibleo:false
        }
    },
    methods:{
        getOrderList(){
            this.$http.get('orders',{params:this.queryInfo}).then(data=>{
                if(data.data.meta.status !==200){
                    this.$message.error('获取商品列表失败')
                }else{
                    this.tableData = data.data.data.goods
                    this.total = data.data.data.total
                    this.pagenum = data.data.data.pagenum
                    console.log(this.tableData)
                }
            } )
        },
        handleSizeChange(val){
            console.log(val)
            this.queryInfo.pagesize=val
            this.getOrderList()
        },
        handleCurrentChange(val){
            console.log(val)
            this.queryInfo.pagenum =val
            this.getOrderList()
        },
        updateAdd(){
            this.dialogVisible=true
        },
        showWuLiu(){
            this.dialogVisibleo = true
        },
    },
    created(){
        this.getOrderList()
    }
}
</script>

<style>
.el-card{
  position:relative;
  padding:0 0 30px;
}
.el-pagination{
  position:absolute;
  left:50%;
  transform:translate(-50%);
  margin:10px 0 0;
}
</style>